package in.muton.panels.paginator.helpers.deletelinks;

import in.muton.edushare.pages.common.EdusharePanel;
import in.muton.panels.paginator.badgehelpers.user.BadgeRoles;

import org.apache.wicket.markup.html.link.Link;
import org.apache.wicket.model.IModel;

import com.edushare.common.vo.Users;

public class UserRemove extends Link<Void> {
	private static final long serialVersionUID = 4945226407032216656L;

	public UserRemove(String id, IModel<Users> userModel, BadgeRoles br,
			EdusharePanel panel) {
		super(id);
		this.br = br;
		this.userModel = userModel;
		this.panel = panel;
	}

	@Override
	public void onClick() {
		if (br != null)
			panel.setError(br.removeUser(userModel.getObject()));
	}

	@Override
	public boolean isVisible() {
		return (br != null) && br.isAdmin();
	}

	private BadgeRoles br;
	private IModel<Users> userModel = null;
	private EdusharePanel panel = null;
}
